{include file="public/header" /}
<style>
    .layui-layer{
        border-radius: 20px;
    }
    .detail-news .flex-layout {
        height: 1.5rem !important;
    }
    .detail-mdl-pro{
        top: 5px !important;
        align-items: center;
    }
    .detail-footer ul ,.model-mdl-btn{
        width: 100%;
    }
    .detail-footer ul li,.model-mdl-btn li{
        width: 100% !important;
        display: block;
        height: 2.25rem;
        line-height: 2.25rem;
        text-align: center;
        border-radius: 5px;
        background: linear-gradient(to right, rgb(253,123,3) 0%, rgb(236,31,34) 100%);
    }
    .infotitle{
        font-size: 16px;
        color: #333;
        padding-bottom: 10px;
    }
    
</style>
<body class="hide-top bgc">
<!-- <div class="pro-list-search">
    <i class="layui-icon layui-icon-left"  onclick="history.go(-1)"></i>
    <p>{$info.title}</p>
</div> -->
<div class="header">
    <i class="layui-icon layui-icon-left"></i>{$info.title}
</div>
<div class="detail-news" style=" margin-top: 65px;">
    <p class="infotitle">{$info.title}</p>
    <div class="price" style="margin-bottom: 10px;">
        <p>￥<span>{$info.price}</span></p>
    </div>
    <p class="flex-layout">收益周期：{$info.day}天 <span>收益率：{$info.sy}%</span></p>
    <p class="flex-layout"><span>到期总收益：{$info.sytoal}</span></p>
</div>

<div class="detail-title flex-center" id="spec">
    <span></span>抢红包详情 <span></span>
</div>
<div class="detail-txt">{:htmlspecialchars_decode($info['content'])}</div>

<div class="detail-footer flex-layout">
    <ul>
        <li>立即购买</li>
    </ul>
</div>


<div class="detail-mdl" style="display: none">
    <div class="detail-mdl-pro">
        <div class="rgt">
            <p class="infotitle">{$info.title}</p>
            <p class="price">￥<span class="vip_price">{$info.price}</span></p>
            <p>剩余库存 <span class="stock">{$info.end_stock}</span></p>
        </div>
    </div>
    <div class="model-mdl-stepper flex-layout">数量
        <div>
            <input type="number" value="1" id="num" readonly>
        </div>
    </div>
    <ul class="model-mdl-btn">
        <li data-type="2" class="buy">
            立即购买
        </li>
    </ul>
</div>
</body>
{include file="public/footer"/}
<script src="/static/index/js/swiper-bundle.js"></script>
<script>
    $(function () {
        const ly = layui.layer, a = $, b = a(".buy"), 
            api = {
                buy: '{:url("packet/submit")}',
            };
        b.click(function () {
            var t = a(this).attr('data-type'), u = t = api.buy, n = a("#num").val();
            return parseInt(n) > 0 ? common.request(u, {
                id: '{$info.id}',
                num: n,
            }) : ly.msg('数量错误');
        })

        a('.detail-footer li').click(function () {
            openSpec();
        });
        a('.det-spec').click(function () {
            openSpec();
        })
        a('.cancel').click(function () {
            ly.closeAll()
        })

        function openSpec() {
            ly.open({
                type: 1,
                offset: 'b',
                anim: 'slideUp',
                area: ['100%', '3%'],
                shade: 0.4,
                closeBtn:0,
                shadeClose: true,
                title:false,
                id: 'ID-demo-layer-direction-b',
                content: a('.detail-mdl')
            });
        }
    })

</script>
</html>